/*********************************************************
          File Name:signals.c
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 26 Jun 2015 05:10:44 PM CST
**********************************************************/

#include "signals.h"
#include <unistd.h>

void install_signal_handler(int signo, void (*handle)(int))
{
    struct sigaction act;

   sigemptyset(&act.sa_mask);

   sigaddset(&act.sa_mask, signo);

   act.sa_flags = SA_RESTART;           // restore
   //act.sa_flags = 0;

    act.sa_flags = 0;

   act.sa_handler = handle;

   sigaction(signo, &act, NULL);
}

